package cn.gok.springbootdemo05thymeleaf;

import cn.gok.springbootdemo05thymeleaf.resover.MyLocalResover;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.LocaleResolver;

@SpringBootApplication
public class SpringbootDemo05ThymeleafApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootDemo05ThymeleafApplication.class, args);
    }


    /**
     * 需要将自定义的LocaleResolver解析器 注入给Spring ，才能实现中英文切换
     * 并且在查找时，Spring不会按照类型查找，所以beanId必须固定为： localeResolver
     * @return
     */
    @Bean
    public LocaleResolver localeResolver(){
        return new MyLocalResover();
    }
}
